package com.buydeem.adapter;

/**
 * 双向适配
 *
 * @author zengchao
 * @date 2022-04-29 14:32:32
 */
public class TwoWayAdapter implements IOldLoginService,INewLoginService{
    private IOldLoginService oldLoginService;
    private INewLoginService newLoginService;

    public TwoWayAdapter(IOldLoginService oldLoginService) {
        this.oldLoginService = oldLoginService;
    }

    public TwoWayAdapter(INewLoginService newLoginService) {
        this.newLoginService = newLoginService;
    }

    @Override
    public void loginWithUserNameAndPassword(String userName, String password) {
        oldLoginService.login(userName, password);
    }

    @Override
    public void login(String userName, String password) {
        newLoginService.loginWithUserNameAndPassword(userName, password);
    }
}
